import Taro from '@tarojs/taro';
import { View, Icon } from "@tarojs/components";
import { AtModal, AtModalContent, AtButton } from "taro-ui";
import "taro-ui/dist/style/components/modal.scss";
import css from "./index.module.less";

export default function SubmitOkModal(props) {
    //visible, setVisible弹窗的可见性以及设置方法
    //url 点击弹窗的确定按钮后跳转的路径
    const { visible, setVisible, url, text } = props;

    const onOk = () => {
        setVisible(false);
        Taro.switchTab({ url });
    };

    return (
        <View className={css.modal}>
            <AtModal isOpened={visible} closeOnClickOverlay={false}>
                <AtModalContent>
                    <View className={css.content}>
                        <Icon className={css.icon} type='waiting' size={50} color='rgb(254,116,42)'></Icon>
                        <View className={css.text1}>提交成功</View>
                        <View className={css.text2}>{text}正在审核中，请耐心等待...</View>
                        <AtButton className={css.okButton} type='primary' circle onClick={onOk}>确定</AtButton>
                    </View>
                </AtModalContent>
            </AtModal>
        </View>

    );
}